﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;

namespace WcfVS2010
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class PersonService:IPersonService
    {
        readonly List<Person> _persons=new List<Person>();
        public void AddPerson(Person p)
        {
            p.Id = Guid.NewGuid().ToString();
            _persons.Add(p);
        }

        public List<Person> GetAllPerson()
        {
            return _persons;
        }

        public void RemovePerson(string id)
        {
            Person person = _persons.Find(p => p.Id == id);
            _persons.Remove(person);
        }
    }
}
